//
//  MessageDialog.hpp
//  client
//
//  Created by DuanHongbo on 15/12/21.
//
//

#ifndef MessageDialog_h
#define MessageDialog_h

#include <stdio.h>

#include "cocos2d.h"
#include "editor-support/cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
#include <functional>

class MessageDialog : public cocos2d::Layer
{
public:
    typedef std::function<void(MessageDialog*)>  ButtonClickDelegate;
public:

    CREATE_FUNC(MessageDialog);
    
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();

    void setMessage(const char* str);
    void setConfirmButton(const char* str);
    void setConfirmCallback(const ButtonClickDelegate& delegate);
    void setCancelCallback(const ButtonClickDelegate& delegate);
    void setCancelButtonStr(const char* str);
    void setTwoButton(bool isTwoBtn);
    
private:
    ButtonClickDelegate _confirmCallback;
    ButtonClickDelegate _cancelCallback;
    
    cocos2d::Node* _rootNode;
    cocos2d::ui::Text* _messageLabel;
    cocos2d::ui::Text* _confirmLabel;
    
    cocos2d::ui::Text* _confirmBtnLabel2;
    cocos2d::ui::Text* _cancelBtnLabel2;
    
    cocos2d::ui::Button* _btnConfirm;
    cocos2d::ui::Button* _btnConfirm2;
    cocos2d::ui::Button* _btnCancel2;
    bool _isTwoButton;
};


#endif /* ConfirmBox_hpp */
